{breadcrumbs}<a href="{$GLOBALS.site_url}/user-groups/">User Groups</a> &#187; {$user_group_info.id}{/breadcrumbs}
{assign var="switchColumns" value=false}
<h1><img src="{image}/icons/users32.png" border="0" alt="" class="titleicon"/> Edit User Group</h1>
<p>
    <a href="{$GLOBALS.site_url}/edit-user-profile/?user_group_sid={$user_group_sid}" class="grayButton">Edit User Profile Fields</a>
    &nbsp;<a href="{$GLOBALS.site_url}/systems/users/acl/?type=group&amp;role={$user_group_sid}" class="grayButton">Manage Permissions</a>
</p>

{foreach from=$errors key=error item=message}
	{if $error eq "USER_GROUP_SID_NOT_SET"}
	<p class="error">User group SID is not set</p>
	{/if}
{/foreach}
<fieldset>
	<legend>User Group Info</legend>
	<form method="post" action="">
		<input type="hidden" id="submit" name="submit" value="save_info" />
		<input type="hidden" name="sid" value="{$object_sid}" />
	<table>
	{foreach from=$form_fields key=field_id item=form_field}
		{if $form_field.id == 'user_activation_email'}
			{assign var="switchColumns" value=true}
			{assign var="group" value="user"}
			</table>
			<div id="mediumButton" class="setting_button">Default Notification Settings<div class="setting_icon"><div id="accordeonClosed"></div></div></div>
				<div  class="setting_block" style="display: none">
				<table>
					<tr>
						<td colspan="3" style='font-size:11px'>These settings will be applied by default for newly registered users of this group.</td>
					</tr>
					<tr>
						<td colspan="3" style='font-size:16px;font-weight: bold;'>General User Notifications:</td>
					</tr>
		{/if}
		{if $form_field.id == 'notify_on_listing_activation'}
			{assign var="group" value="listing"}
			<tr>
				<td colspan="3" style='font-size:16px;font-weight: bold;'>Listing Notifications:</td>
			</tr>
		{/if}
		{if $form_field.id == 'notify_on_application_approve'}
			{assign var="group" value="other"}
		{/if}
		{if $form_field.id == 'notify_subscription_activation'}
			<tr>
				<td colspan="3" style='font-size:16px;font-weight: bold;'>Product Notifications:</td>
			</tr>
			{assign var="group" value="product"}
		{/if}
		{if $form_field.id == 'notify_subscription_expire_date' || $form_field.id == 'notify_subscription_expire_date_days' || $form_field.id == 'notify_listing_expire_date' || $form_field.id == 'notify_listing_expire_date_days' || $form_field.id == 'notify_on_application_approve' || $form_field.id == 'notify_on_application_reject' }
			{if $form_field.id == 'notify_subscription_expire_date'}
				<tr>
					<td colspan="1">{$form_field.caption}{if $form_field.is_required}<font color="red">*</font>{/if}</td>
					<td colspan="2">
						{input property=$form_field.id template="list_none.tpl"}
						{if $user_group_info[$form_field.id]}
						<a href="{$GLOBALS.site_url}/edit-email-templates/{$group}/{$user_group_info[$form_field.id]}"
						   target="_blank"><img src="{image}pen.png" border="0" alt="Edit {$form_field.caption}"
												title="Edit {$form_field.caption}" class="editEmailTemp"/></a>
						{/if}
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td class="notifications">{input property=$form_fields.notify_subscription_expire_date_days.id}</td>
					<td>Days before</td>
				</tr>
			{elseif $form_field.id == 'notify_listing_expire_date'}
				<tr>
					<td colspan="1">{$form_field.caption}{if $form_field.is_required}<font color="red">*</font>{/if}</td>
					<td colspan="2">
						{input property=$form_field.id template="list_none.tpl"}
						{if $user_group_info[$form_field.id]}
						<a href="{$GLOBALS.site_url}/edit-email-templates/{$group}/{$user_group_info[$form_field.id]}"
						   target="_blank"><img src="{image}pen.png" border="0" alt="Edit {$form_field.caption}"
												title="Edit {$form_field.caption}" class="editEmailTemp"/></a>
						{/if}
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td class="notifications">{input property=$form_fields.notify_listing_expire_date_days.id}</td>
					<td>Days before</td>
				</tr>
			{elseif $form_field.id eq 'notify_on_application_approve' || $form_field.id eq 'notify_on_application_reject'}
				{if $user_group_info.id == 'JobSeeker'}
				<tr>
					<td colspan="1">{$form_field.caption}{if $form_field.is_required}<font color="red">*</font>{/if}</td>
					<td colspan="2">
						{input property=$form_field.id template="list_none.tpl"}
						{if $user_group_info[$form_field.id]}
						<a href="{$GLOBALS.site_url}/edit-email-templates/{$group}/{$user_group_info[$form_field.id]}"
						   target="_blank"><img src="{image}pen.png" border="0" alt="Edit {$form_field.caption}"
												title="Edit {$form_field.caption}" class="editEmailTemp"/></a>
						{/if}
					</td>
				</tr>
				{/if}
			{/if}
		{else}
			<tr>
				{if $switchColumns}
					<td colspan="1">{$form_field.caption}{if $form_field.is_required}<font color="red">*</font>{/if}</td>
					<td colspan="2">
						{input property=$form_field.id template="list_none.tpl"}
						{if $user_group_info[$form_field.id]}
						<a href="{$GLOBALS.site_url}/edit-email-templates/{$group}/{$user_group_info[$form_field.id]}"
						   target="_blank"><img src="{image}pen.png" border="0" alt="Edit {$form_field.caption}"
												title="Edit {$form_field.caption}" class="editEmailTemp"/></a>
						{/if}
					</td>
				{else}
					<td valign="top" width="42%">{$form_field.caption}</td>
					<td>{if $form_field.is_required}<font color="red">*</font>{/if}</td>
					<td>{input property=$form_field.id}</td>
				{/if}
			</tr>
		{/if}
	{/foreach}
	</table>
	</div>
        <div class="clr"><br/></div>
        <div class="floatRight">
            <input type="submit" id="apply" value="Apply" class="grayButton"/>
            <input type="submit" value="Save" class="grayButton" />
        </div>
	</form>
</fieldset>

<div  class="setting_block" style="display: none"></div>
<div class="clr"><br/></div>

<h2>Products</h2>
<table>
	<thead>
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>User number</th>
            <th>Default</th>
            <th colspan="2">Order</th>
        </tr>
	</thead>
	<tbody>
        {foreach from=$user_group_products_info item=products_info  name=items_block}
            <tr class="{cycle values = 'evenrow,oddrow'}">
                <td>{$products_info.sid}</td>
                <td><a href="{$GLOBALS.site_url}/edit-product/?sid={$products_info.sid}">{$products_info.name}</a></td>
                {assign var="product_sid" value=$products_info.sid}
                <td>{$user_group_product_user_number.$product_sid}</td>
                <td><input class="default-plan" value="{$products_info.sid}" type="checkbox" {if $user_group_info.default_product == $products_info.sid}checked="checked"{/if}" /></td>
                <td>
                    {if $smarty.foreach.items_block.iteration < $smarty.foreach.items_block.total}
                        <a href="?product_sid={$products_info.sid}&amp;action=move_down&amp;sid={$user_group_sid}"><img src="{image}b_down_arrow.gif" border="0" alt=""/></a>
                    {/if}
                </td>
                <td>
                    {if $smarty.foreach.items_block.iteration > 1}
                        <a href="?product_sid={$products_info.sid}&amp;action=move_up&amp;sid={$user_group_sid}"><img src="{image}b_up_arrow.gif" border="0" alt="" /></a>
                    {/if}
                </td>
            </tr>
        {/foreach}
	</tbody>
</table>

<p>Users of this group will be automatically subscribed (free of charge) to the product marked as <strong>Default</strong> after registration</p>

{literal}
    <script type="text/javascript">

            $(document).ready(function() {

            $('.default-plan').change( function() {
        var plan = 0;
        if (this.checked) {
            plan = this.value
        }
            location.href = '?product_sid=' + plan + '&action=set_default_product&sid={/literal}{$user_group_sid}{literal}';
    });

        $(".setting_button").click(function(){
            var butt = $(this);
            $(this).next(".setting_block").slideToggle("normal", function(){
                if ($(this).css("display") == "block") {
                    butt.children(".setting_icon").html("<div id='accordeonOpen'></div>");
                } else {
                    butt.children(".setting_icon").html("<div id='accordeonClosed'></div>");
                }
            });
        });

        $('#apply').click(
                function(){
                    $('#submit').attr('value', 'apply_info');
                }
        );

    });

    </script>
{/literal}